import tkinter
from tkinter import filedialog,dialog
import os
root = tkinter.Tk()

def open():
    file = filedialog.asksaveasfilename(title='选择文件',filetypes=[("PNG",".png"),("GPF",".gpf"),("JPG",".jpg"),("python",".py")],initialfile='udp聊天记录',initialdir=os.path.expanduser('桌面:'))

tkinter.Button(root,text='打开',command=open).pack()

root.mainloop()